package dto

import (
	"github.com/gin-gonic/gin"
	"tino_manager/public"
)

type ManagerLoginInput struct {
	Phone    string `json:"phone" form:"phone" comment:"手机号" validate:"required"`
	Password string `json:"password" form:"password" comment:"密码" validate:"required"`
	Code     string `json:"code" form:"code" comment:"code" validate:"required"`
}

func (params *ManagerLoginInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type ManagerAddInput struct {
	Phone     string `json:"phone" form:"phone" comment:"手机号" validate:"required"`
	HeadImage string `json:"head_image" form:"head_image" comment:"头像" validate:"required"`
	UserName  string `json:"user_name" form:"user_name" comment:"用户名称" validate:"required"`
	Password  string `json:"password" form:"password" comment:"密码"`
}

func (params *ManagerAddInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type ManagerPageInput struct {
	Type       string `json:"type" form:"type" comment:"查询类型"`
	PageSize   int    `json:"page_size" form:"page_size" comment:"每页数量" validate:"required,lte=20"`
	PageNumber int    `json:"page_number" form:"page_number" comment:"页码" validate:"required"`
	KeyWord    string `json:"keyword" form:"keyword" comment:"搜索关键词"`
}

func (params *ManagerPageInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type ManagerInfo struct {
	Id            string `json:"id" gorm:"column:id;comment:自增id"`
	UserName      string `json:"user_name"`
	OpenId        string `json:"open_id"`
	HeadImage     string `json:"head_image"`
	MessageAppId  string `json:"message_app_id"`
	MessageOpenId string `json:"message_open_id"`
	Phone         string `json:"phone"`
	Status        uint8  `json:"status"`
	IsDelete      uint8  `json:"is_delete"`
	UpdatedAt     string `json:"update_at"`
	CreatedAt     string `json:"create_at"`
}

type ManagerPageOutput struct {
	List  []ManagerInfo `json:"list"`
	Total int64         `json:"total"`
}
type UpdatePasswordInput struct {
	OldPassword string `json:"old_password" form:"old_password" comment:"原始密码" validate:"required"`
	Password    string `json:"password" form:"password" comment:"新密码" validate:"required"`
}

func (params *UpdatePasswordInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type ManagerRemoveInput struct {
	Id string `json:"id" form:"id" comment:"id" validate:"required"`
}

func (params *ManagerRemoveInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}

type ManagerUpdateInput struct {
	Id        int64  `json:"id" form:"id" comment:"用户id" validate:"required"`
	UserName  string `json:"user_name" form:"user_name" comment:"用户昵称" validate:"required"`
	HeadImage string `json:"head_image" form:"head_image" comment:"用户头像" validate:"required"`
	Phone     string `json:"phone" form:"phone" comment:"用户手机号" validate:"required"`
}

func (params *ManagerUpdateInput) BindValidParam(c *gin.Context) error {
	return public.DefaultGetValidParams(c, params)
}
